package com.neoden.notes;

import android.os.Parcel;
import android.os.Parcelable;

public class Note implements Parcelable {

	private long id;
	private String title;
	private String note;
	private long createdTS;
	private long modifiedTS;
	private long listId;
	
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	
	public String getNote() {
		return note;
	}
	public void setNote(String note) {
		this.note = note;
	}

	public long getCreatedTS() {
		return createdTS;
	}
	public void setCreatedTS(long createdTS) {
		this.createdTS = createdTS;
	}
	
	public long getModifiedTS() {
		return modifiedTS;
	}
	public void setModifiedTS(long modifiedTS) {
		this.modifiedTS = modifiedTS;
	}
	
	public long getListId() {
		return listId;
	}
	public void setListId(long listId) {
		this.listId = listId;
	}
	
	public Note() {
		
	}
	
	public void consume(Note note) {
		this.id = note.getId();
		this.title = note.getTitle();
		this.note = note.getNote();
		this.createdTS = note.getCreatedTS();
		this.modifiedTS = note.getModifiedTS();
		this.listId = note.getListId();
	}
	
	@Override
	public String toString() {
		return title;
	}
	public int describeContents() {
		return 0;
	}
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeLong(id);
		dest.writeString(title);
		dest.writeString(note);
		dest.writeLong(createdTS);
		dest.writeLong(modifiedTS);
		dest.writeLong(listId);
	}
	
    public static final Parcelable.Creator<Note> CREATOR
	    = new Parcelable.Creator<Note>() 
	{
		public Note createFromParcel(Parcel in) {
		    return new Note(in);
		}
		
		public Note[] newArray(int size) {
		    return new Note[size];
		}
	};
	
	private Note(Parcel in) {
		this.id = in.readLong();
		this.title = in.readString();
		this.note = in.readString();
		this.createdTS = in.readLong();
		this.modifiedTS = in.readLong();
		this.listId = in.readLong();
	}
}
